package com.redare.dev.smart.generator.service.service;

import com.redare.dev.smart.generator.sdk.pojo.GeneratorSys;
import com.redare.dev.smart.generator.sdk.pojo.form.GeneratorSysForm;
import com.redare.dev.smart.generator.service.dao.GeneratorSysDao;
import com.redare.devframework.common.pojo.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

;


/**
 * 业务系统 impl
 *
 * @date 2021-08-27 15:19:22
 * Created by yangqiangyu
 */
@Service(value = "com.redare.dev.smart.generator.service.GeneratorSysService")
public class GeneratorSysService {

    @Autowired
    GeneratorSysDao generatorSysDao;


    public boolean addGeneratorSys(GeneratorSysForm.Add form) {
        long id = generatorSysDao.addGeneratorSys(form);
        return id > 0;
    }

    public boolean editGeneratorSys(GeneratorSysForm.Edit form) {
        return generatorSysDao.editGeneratorSys(form) > 0;
    }

    public boolean deleteGeneratorSys(GeneratorSysForm.Del form) {
        return generatorSysDao.deleteGeneratorSys(form) > 0;
    }

    public List<GeneratorSys> findGeneratorSysList(GeneratorSysForm.Search form) {
        return generatorSysDao.findGeneratorSysPage(form, 1, 20, false, true).getResult();
    }

    public List<GeneratorSys> findGeneratorSysList(GeneratorSysForm.Search form, int curPage, int pageSize) {
        return generatorSysDao.findGeneratorSysPage(form, curPage, pageSize, false, false).getResult();
    }

    public Page<GeneratorSys> findGeneratorSysPage(GeneratorSysForm.Search form, int curPage, int pageSize) {
        return generatorSysDao.findGeneratorSysPage(form, curPage, pageSize, true, false);
    }

    public GeneratorSys getGeneratorSys(GeneratorSysForm.Get form) {
        return generatorSysDao.getGeneratorSys(form);

    }


}

